<?php

namespace App\Models\Application;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class Columnrec
 * @package App\Models\Application
 * @version July 13, 2018, 6:44 pm CST
 *
 * @property \App\Models\Application\Muticolumn muticolumn
 * @property \App\Models\Application\Paneltpl paneltpl
 * @property integer muticolumn_id
 * @property integer paneltpl_id
 * @property string area
 */
class Columnrec extends Model
{
    use SoftDeletes;


    public $table = 'columnrecs';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'muticolumn_id',
        'paneltpl_id',
        'area'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'muticolumn_id' => 'integer',
        'paneltpl_id' => 'integer',
        'area' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function muticolumn()
    {
        return $this->hasOne(\App\Models\Application\Muticolumn::class, 'id', 'muticolumn_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function paneltpl()
    {
        return $this->hasOne(\App\Models\Application\Paneltpl::class, 'id', 'paneltpl_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     * 栏目推荐数据
     **/
    public function columnrecommenddatas()
    {
        return $this->belongsToMany(\App\Models\Application\ColumnRecommendData::class, 'columnrec_column_recommend_datas', 'columnrec_id', 'column_recommend_data_id');
    }
}
